function register() {
  const username = document.getElementById('username').value;
  const password = document.getElementById('password').value;
  const confirmPassword = document.getElementById('confirmPassword').value;
  const email = document.getElementById('email').value;
  const phoneNumber = document.getElementById('phoneNumber').value;
  const idCard = document.getElementById('idCard').value;

  // 使用fetch API发起异步请求
  fetch('/user/register', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      username: username,
      password: password,
      email: email,
      phoneNumber: phoneNumber,
      idCard: idCard
    })
  })
    .then(response => response.json())
    .then(data => {
      if (data.code === 200) {
        // 注册成功，弹出提示并跳转到登录页面
        alert("您已注册成功");
        window.location.href = 'src/subpage/login.html'; // 重定向到登录页面
      } else {
        alert("注册失败");
      }
    })
    .catch(error => {
      // 处理错误
      console.error('Error:', error);
    });
}

// 注册失败，
